<template>
	<view class="my-store-info">
		<view class="store-box">
			<view class="title">*店铺信息</view>
			<view class="store-form">
				<u-cell-group>
					<u-cell title="进件类型" arrow-direction="right" :isLink="true" @click="openType">
						<u-icon slot="icon" size="32">*</u-icon><text slot="value"
							class="u-slot-value">{{typeText}}</text>
					</u-cell>
					<u-cell title="企业类型" arrow-direction="right" :isLink="true" @click="openEntType">
						<u-icon slot="icon" size="32">*</u-icon><text slot="value"
							class="u-slot-value">{{EnttypeText}}</text>
					</u-cell>
					<u-cell title="店铺名称">
						<u--input slot="value" placeholder="和营业执照保持一致" fontSize="14px" border="none"
							v-model="storeInfo.merchantName"></u--input>
					</u-cell>
					<u-cell title="店铺简称">
						<u--input slot="value" placeholder="店铺简称" fontSize="14px" v-model="storeInfo.merchantAlias"
							border="none"></u--input>
					</u-cell>
					<u-cell title="店铺描述">
						<u--textarea slot="value" v-model="storeInfo.merchantDesc" placeholder="请输入内容"
							fontSize="14px"></u--textarea>

					</u-cell>
					<u-cell title="成立日期" arrow-direction="right" :isLink="true" @click="openFound">
						<u-icon slot="icon" size="32">*</u-icon><text slot="value"
							class="u-slot-value">{{storeInfo.foundDate}}</text>
					</u-cell>
					<u-cell title="注册资本">
						<u--input slot="value" placeholder="注册资本" fontSize="14px" v-model="storeInfo.regCapital"
							border="none"></u--input>
					</u-cell>
				</u-cell-group>
			</view>
		</view>
		<view class="store-box">
			<view class="title">*联系方式</view>
			<view class="store-form">
				<u-cell-group>
					<u-cell title="联系人">
						<u--input slot="value" placeholder="联系人" fontSize="14px" border="none"
							v-model="storeInfo.merchantPerson"></u--input>
					</u-cell>
					<u-cell title="联系电话">
						<u--input slot="value" placeholder="联系电话" fontSize="14px" type="number" border="none"
							v-model="storeInfo.merchantPhone"></u--input>
					</u-cell>
					<u-cell title="邮箱地址">
						<u--input slot="value" placeholder="邮箱地址" border="none" fontSize="14px"
							v-model="storeInfo.merchantEmail"></u--input>
					</u-cell>
					<u-cell title="客服电话">
						<u--input slot="value" v-model="storeInfo.merchantServicePhone" type="number" border="none"
							fontSize="14px"></u--input>
					</u-cell>
				</u-cell-group>
			</view>
		</view>
		<view class="store-box">
			<view class="title">*店铺类目</view>
			<view class="store-form">
				<u-cell-group>
					<u-cell title="主营类目" arrow-direction="right" :isLink="true" @click="openCategory">
						<view class="text" slot="value">{{mainBusiness}}</view>
					</u-cell>
					<u-cell title="微信类目" arrow-direction="right" :isLink="true" @click="openWeiXinCategory">
						<view class="text" slot="value">{{weiXinBusiness}}</view>
					</u-cell>
					<u-cell title="经营范围">
						<u--input slot="value" placeholder="经营范围" fontSize="14px" border="none"
							v-model="storeInfo.businessScope"></u--input>
					</u-cell>
				</u-cell-group>
			</view>
		</view>
		<view class="store-box">
			<view class="title">*门店照片</view>
			<view class="store-form">
				<u-cell-group>
					<u-cell title="门面照片">
						<u-upload :fileList="facadeList" @afterRead="afterReadfacade" @delete="deletePicfacade" name="1"
							slot="value" :multiple="true" :maxCount="10"></u-upload>

					</u-cell>
					<u-cell title="前台照片">
						<u-upload :fileList="receptionList" @afterRead="afterReadrecep" @delete="deletePicrecep"
							name="2" slot="value" :multiple="true" :maxCount="10"></u-upload>
					</u-cell>
					<u-cell title="店铺内景照">
						<u-upload :fileList="CashierList" @afterRead="afterReadCashier" @delete="deletePicCashier"
							name="4" slot="value" :multiple="false" :maxCount="1"></u-upload>
					</u-cell>
				</u-cell-group>
			</view>
		</view>
		<view class="store-box" v-if="storeInfo.merchantBusinessType!=3">
			<view class="title">*上传经营资质图片</view>
			<view class="store-form">
				<u-cell-group>
					<u-cell title="营业执照号">
						<u--input slot="value" placeholder="营业执照号" fontSize="14px" border="none"
							v-model="storeInfo.licenseNo"></u--input>

					</u-cell>
					<u-cell title="营业执照地址">
						<u--input slot="value" placeholder="营业执照地址" fontSize="14px" border="none"
							v-model="storeInfo.licenseAddress"></u--input>
					</u-cell>
					<u-cell title="开始时间" arrow-direction="right" :isLink="true">
						<picker mode="date" slot="value" :value="storeInfo.licenseStart" :start="startDate"
							:end="endDate" @change="bindDateChangeStart">
							<view class="uni-input" style="width: 350rpx;height: 44rpx; text-align: right;">
								{{storeInfo.licenseStart}}
							</view>
						</picker>

					</u-cell>
					<u-cell title="结束时间(长期:2099-12-30)" arrow-direction="right" :isLink="true">
						<picker mode="date" slot="value" :value="storeInfo.licenseEnd" :start="startDate" :end="endDate"
							@change="bindDateChangeEnd">
							<view class="uni-input" style="width: 200rpx;height: 44rpx;text-align: right;">
								{{storeInfo.licenseEnd}}
							</view>
						</picker>

					</u-cell>
					<u-cell title="营业执照">
						<u-upload :fileList="licenseList" @afterRead="afterReadLicense" @delete="deletePicLicense"
							name="3" slot="value" :multiple="false" :maxCount="1"></u-upload>
					</u-cell>
				</u-cell-group>
			</view>
		</view>
		<u-popup :show="showType" :closeOnClickOverlay="true" @close="closeType">
			<view class="tylist">
				<view class="li" v-for="(item,index) in typeList" :key="index" @tap="selectType(item)">{{item.label}}
				</view>
			</view>
		</u-popup>
		<u-popup :show="showEntType" :closeOnClickOverlay="true" @close="closeEntType">
			<view class="tylist">
				<view class="li" v-for="(item,index) in EntTypeList" :key="index" @tap="selectEntType(item)">
					{{item.label}}
				</view>
			</view>
		</u-popup>
		<u-popup :show="showMainCategory" :closeOnClickOverlay="true" @close="closeCategory">
			<view class="tylist" :style="styleObj">
				<view class="li" v-for="(item,index) in MainCategoryList" :key="index" @tap="selectCategory(item)">
					{{item.className}}
				</view>
			</view>
		</u-popup>
		<u-popup :show="showWeiXinCategory" :closeOnClickOverlay="true" :closeable="true" @close="closeWeiXinCategory">
			<view class="tylist" :style="styleObj">
				<scroll-view :scroll-y="true" class="scroll-Y">
					<view class="li-one-box" v-for="(item,index) in WeiXinCategoryList" :key="index">
						<view class="li-one-title" @tap="childOne(item,index)">{{item.name}}</view>
						<view class="li-two-box" v-if="item.isShow==true" v-for="(aa,i) in item.children" :key="i">
							<view class="li-two-title" @tap="childTwo(aa,index,i)">{{aa.name}}</view>
							<view class="li-three-box" v-if="aa.isShow==true" v-for="(bb,j) in aa.children" :key="j">
								<view class="li-three-title" @tap="selectWxClass(bb)">{{bb.name}}</view>
							</view>
						</view>
					</view>
				</scroll-view>

			</view>
		</u-popup>
		<u-datetime-picker ref="datetimePicker" :show="showFoundDate" :minDate="315547201000" @close="closeFoundDate" v-model="foundDate"
			:formatter="formatterDate" @confirm="sureDoundDate" mode="date"></u-datetime-picker>
		<view class="btn" @tap="jump()">下一步</view>
	</view>
</template>

<script>
	const app = getApp();
	const globalData = app.globalData;
	const apiUrl = globalData.wxApi;
	const wxImg = globalData.wxImg;
	let deviceInfo = {};
	uni.getSystemInfo({
		success: res => {
			console.log(res)
			deviceInfo = res;
		}
	});
	import {
		getStoreData,
		dealNum,
		httpPost,
		httpGet,
		bdMapToTxMap,
		txMapToBdMap,
	} from "@/utils/http.js";
	import mpMixin from "@/uni_modules/uview-ui/libs/mixin/mpMixin";
	const pic1 = require(`@/img/my/my1.png`);
	import popupActivity from "./component/popupActivity";


	export default {
		data() {
			return {
				wxImg,
				apiUrl,
				dealNum,
				pic1,
				cityFlag: false,
				value: "",
				mode: "single",
				storeInfo: {
					merchantName: "", //店铺名称
					merchantAlias: "", //简称
					merchantDesc: "", //描述
					accountType: "", //账户类型
					merchantBusinessType: "", //商户类型
					settlementType: "", //结算类型
					merchantPerson: "",
					merchantPhone: "",
					merchantEmail: "",
					merchantServicePhone: "",
					sellerClassId: "", //店铺营业分类
					businessCode: "", //行业类目编码
					businessName: "", //行业类目名称
					imgLogo: "", //商户门头照片
					imgIndoor: "", //内部前台照片
					imgLicense: "", //营业执照图片
					licenseNo: "",
					licenseAddress: "",
					licenseStart: "0",
					licenseEnd: "0",
					entType: "", //企业类型
					foundDate: "", //成立日期
					regCapital: "", //注册资本
					businessScope: "", //经营范围
					imgCashierDesk: "" //店铺内景照
				},
				userInfo: {},
				flag: false,
				title: "",
				typeList: [{
						merchantBusinessType: "1",
						accountType: "1",
						settlementType: "1",
						label: "企业对公结算"
					}, {
						merchantBusinessType: "1",
						accountType: "2",
						settlementType: "1",
						label: "企业对私法人结算"
					},
					{
						merchantBusinessType: "1",
						accountType: "2",
						settlementType: "2",
						label: "企业对私非法人结算"
					}, {
						merchantBusinessType: "2",
						accountType: "1",
						settlementType: "1",
						label: "个体户对公结算"
					},
					{
						merchantBusinessType: "2",
						accountType: "2",
						settlementType: "1",
						label: "个体户对私法人结算"
					}, {
						merchantBusinessType: "2",
						accountType: "2",
						settlementType: "2",
						label: "个体户对私非法人结算"
					}, {
						merchantBusinessType: "3",
						accountType: "2",
						settlementType: "1",
						label: "小微对私结算"
					}
				],
				showType: false,
				typeText: "",
				mainBusiness: "",
				weiXinBusiness: "",
				facadeList: [],
				receptionList: [],
				showMainCategory: false,
				MainCategoryList: [],
				showWeiXinCategory: false,
				WeiXinCategoryList: [],
				WeiXinCategoryListTwo: [],
				isShowTwo: false,
				isShowThree: false,
				facadeImgs: [],
				receptionImgs: [],
				licenseList: [],
				licenseImg: [],
				showDateStart: false,
				showDateEnd: false,
				screenHeight: deviceInfo.screenHeight,
				styleObj: {
					maxHeight: deviceInfo.screenHeight * 0.9 + 'px',
					overflow: 'auto',
				},
				EntTypeList: [{
						id: 1,
						label: "政府机构"
					}, {
						id: 2,
						label: "国营企业"
					},
					{
						id: 3,
						label: "私营企业"
					}, {
						id: 4,
						label: "外资企业"
					}, {
						id: 5,
						label: "个体工商户"
					}, {
						id: 6,
						label: "其它组织"
					}, {
						id: 7,
						label: "事业单位"
					}, {
						id: 9,
						label: "业主委员会"
					}
				],
				showEntType: false,
				EnttypeText: "",
				showFoundDate: false,
				foundDate: "",
				CashierList: [],
				CashierImg: []

			};
		},
		components: {
			popupActivity,
		},
		computed: {
			startDate() {
				return this.getDate('start');
			},
			endDate() {
				return this.getDate('end');
			}
		},
		onReady() {
			// 微信小程序需要用此写法
			this.$refs.datetimePicker.setFormatter(this.formatterDate)
		},
		onShow() {

		},
		onUnload() {

		},

		onLoad(options) {
			this.getStoreinfo();
			// const creatStoreInfo = uni.getStorageSync('creatStoreInfo');
			// if(creatStoreInfo){
			// 	this.storeInfo=creatStoreInfo;
			// }
		},
		methods: {
			getStoreinfo() {
				let that = this;
				httpGet("/api/sellerstore/selfInfo")
					.then((res) => {
						if (res.data) {
							that.storeInfo = res.data;
							that.typeText = that.getStoreType(that.storeInfo);
							that.mainBusiness = that.storeInfo.sellerClassName;
							that.weiXinBusiness = that.storeInfo.businessName;
							let imgLogoArr = that.storeInfo.imgLogo.split(',');
							let imgIndoorArr = that.storeInfo.imgIndoor.split(',');
							let Cashier=that.storeInfo.imgCashierDesk.split(',');
							if (that.storeInfo.imgLicense && that.storeInfo.imgLicense != "") {
								let imgLicenseArr = that.storeInfo.imgLicense.split(',');
								that.licenseList = imgLicenseArr.map((item) => {
									let obj = {};
									obj.url = wxImg + item;
									return obj
								});
							}
							that.facadeList = imgLogoArr.map((item) => {
								let obj = {};
								obj.url = wxImg + item;
								return obj
							});
							that.receptionList = imgIndoorArr.map((item) => {
								let obj = {};
								obj.url = wxImg + item;
								return obj
							});
							that.CashierList=Cashier.map((item) => {
								let obj = {};
								obj.url = wxImg + item;
								return obj
							});



						}
					})
					.catch((e) => {});
			},
			getStoreType(storeInfo) {
				let text = "";
				if (storeInfo.merchantBusinessType == 1 && storeInfo.accountType == 1 && storeInfo.settlementType == 1) {
					text = "企业对公结算";
				}
				if (storeInfo.merchantBusinessType == 1 && storeInfo.accountType == 2 && storeInfo.settlementType == 1) {
					text = "企业对私法人结算";
				}
				if (storeInfo.merchantBusinessType == 1 && storeInfo.accountType == 2 && storeInfo.settlementType == 2) {
					text = "企业对私非法人结算";
				}
				if (storeInfo.merchantBusinessType == 2 && storeInfo.accountType == 1 && storeInfo.settlementType == 1) {
					text = "个体户对公结算";
				}
				if (storeInfo.merchantBusinessType == 2 && storeInfo.accountType == 2 && storeInfo.settlementType == 1) {
					text = "个体户对私法人结算";
				}
				if (storeInfo.merchantBusinessType == 2 && storeInfo.accountType == 2 && storeInfo.settlementType == 2) {
					text = "个体户对私非法人结算";
				}
				if (storeInfo.merchantBusinessType == 3 && storeInfo.accountType == 2 && storeInfo.settlementType == 1) {
					text = "小微对私结算";
				}
				return text;
			},
			openType() {
				this.showType = true;
			},
			selectType(data) {
				this.storeInfo.accountType = data.accountType;
				this.storeInfo.merchantBusinessType = data.merchantBusinessType;
				this.storeInfo.settlementType = data.settlementType;
				this.typeText = data.label;
				this.showType = false;
			},

			selectCategory(data) {
				this.storeInfo.sellerClassId = data.id;
				this.mainBusiness = data.className;
				this.showMainCategory = false;

			},
			openCategory() {
				this.getCategoryList();
				this.showMainCategory = true;

			},
			getCategoryList() {
				const that = this;
				httpGet("/api/sellerstoreclass/list")
					.then((res) => {
						console.log(res)
						if (res.success) {
							that.MainCategoryList = res.data;
						} else {
							that.MainCategoryList = [];
						}
					})
					.catch((e) => {});
			},
			closeCategory() {
				this.showMainCategory = false;
			},
			closeType() {
				this.showType = false;
			},
			closeWeiXinCategory() {
				this.showWeiXinCategory = false;
			},
			openWeiXinCategory() {
				this.showWeiXinCategory = true;
				this.getWeiXinOneList();
			},
			getWeiXinOneList() {
				const that = this;
				httpGet("/api/sellerstore/wxClass/top")
					.then((res) => {
						console.log(res)
						if (res.success) {
							that.WeiXinCategoryList = res.data.map((item) => {
								item.isShow = false;
								item.children = [];
								return item
							});
						} else {
							that.WeiXinCategoryList = [];
						}
					})
					.catch((e) => {
						that.WeiXinCategoryList = [];
					});
			},
			childOne(data, index) {
				console.log(data)
				const that = this;
				httpGet(`/api/sellerstore/wxClass/subList/${data.id}`)
					.then((res) => {
						//console.log(res)
						if (res.success) {
							that.WeiXinCategoryList[index].children = res.data.map((item) => {
								item.isShow = false;
								item.children = [];
								return item;
							})

							that.WeiXinCategoryList = that.WeiXinCategoryList.map((item, j) => {
								if (j == index) {
									item.isShow = true;
								} else {
									item.isShow = false;
								}
								return item;
							})
							console.log(that.WeiXinCategoryList)
						}
					})
					.catch((e) => {

					});


			},
			childTwo(data, index, i) {
				const that = this;
				httpGet(`/api/sellerstore/wxClass/subList/${data.id}`)
					.then((res) => {
						if (res.success) {
							that.WeiXinCategoryList[index].children[i].children = res.data;
							that.WeiXinCategoryList[index].children[i].isShow = true;
							that.WeiXinCategoryList[index].children = that.WeiXinCategoryList[index].children.map((
								item, j) => {
								if (j == i) {
									item.isShow = true;
								} else {
									item.isShow = false;
								}
								return item;
							})
						}
					})
					.catch((e) => {

					});

			},
			selectWxClass(data) {
				console.log(data)
				this.storeInfo.businessCode = data.classId;
				this.storeInfo.businessName = data.name;
				this.weiXinBusiness = data.name;
				this.showWeiXinCategory = false;
				console.log(this.weiXinBusiness)
			},
			async afterReadfacade(event) {
				//console.log(event)
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file);

				let fileListLen = this.facadeList.length;
				lists.map((item) => {
					this.facadeList.push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url)
					//console.log('666',result)
					//this.facadeImgs.push(result[0].path+'/'+name);
					let item = this.facadeList[fileListLen]
					this.facadeList.splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
				//console.log(this.facadeList,this.facadeImgs);
				this.getFacadeImgList(this.facadeList);

			},
			deletePicfacade(event) {
				this.facadeList.splice(event.index, 1)
				this.getFacadeImgList(this.facadeList);
			},
			getFacadeImgList(list) {
				console.log(list)
				if (list.length == 0) {
					this.facadeImgs = [];
				} else {
					this.facadeImgs = list.map((item) => {
						let imgUrl = item.url[0].path + '/' + item.url[0].name;
						return imgUrl
					})
				}

				console.log(this.facadeImgs)
				this.storeInfo.imgLogo = this.facadeImgs.join(",");
			},
			async afterReadrecep(event) {
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [].concat(event.file)
				let fileListLen = this.receptionList.length
				lists.map((item) => {
					this.receptionList.push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url)
					let item = this.receptionList[fileListLen]
					this.receptionList.splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
				this.getReceptImgList(this.receptionList);
			},
			deletePicrecep(event) {
				this.receptionList.splice(event.index, 1);
				this.getReceptImgList(this.receptionList);
			},
			getReceptImgList(list) {
				console.log(list)
				if (list.length == 0) {
					this.receptionImgs = [];
				} else {
					this.receptionImgs = list.map((item) => {
						let imgUrl = item.url[0].path + '/' + item.url[0].name;
						return imgUrl
					})
				}
				this.storeInfo.imgIndoor = this.receptionImgs.join(",");
			},
			uploadFilePromise(url) {
				return new Promise((resolve, reject) => {
					let a = uni.uploadFile({
						url: 'https://api.chain-pay.cn/api/upload/store',
						filePath: url,
						name: 'file',
						header: {
							"Authorization": uni.getStorageSync("token")
						},

						success: (res) => {
							let imgObj = JSON.parse(res.data);
							console.log(JSON.parse(res.data))
							setTimeout(() => {
								resolve(imgObj.data)
							}, 1000)
						}
					});
				})
			},
			openStart() {
				this.showDateStart = true;
			},
			openEnd() {
				this.showDateEnd = true;
			},

			async afterReadLicense(event) {
				console.log(event)
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [];
				lists[0] = event.file;

				let fileListLen = this.licenseList.length
				lists.map((item) => {
					this.licenseList.push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url)
					let item = this.licenseList[fileListLen]
					this.licenseList.splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
				this.getLicenseImgList(this.licenseList);
			},
			deletePicLicense(event) {
				this.licenseList.splice(event.index, 1)
				this.getFacadeImgList(this.licenseList);
			},
			getLicenseImgList(list) {
				console.log(list)
				if (list.length == 0) {
					this.licenseImg = [];
				} else {
					this.licenseImg = list.map((item) => {
						let imgUrl = item.url[0].path + '/' + item.url[0].name;
						return imgUrl
					})
				}
				this.storeInfo.imgLicense = this.licenseImg.join(",");
			},

			jump() {
				if (!this.storeInfo.accountType) {
					uni.showToast({
						icon: "none",
						title: "请选择进件类型"
					});
					return;
				} else if (!this.storeInfo.entType) {
					uni.showToast({
						icon: "none",
						title: "请选择企业类型"
					});
					return;
				} else if (this.storeInfo.entType==2||this.storeInfo.entType==3||this.storeInfo.entType==4) {
					if(!this.storeInfo.regCapital){
						uni.showToast({
							icon: "none",
							title: "请填写注册资本"
						});
						return;
					}
					
				} else if (!this.storeInfo.merchantName) {
					uni.showToast({
						icon: "none",
						title: "请填写店铺名称"
					});
					return;
				} else if (!this.storeInfo.merchantAlias) {
					uni.showToast({
						icon: "none",
						title: "请填写店铺简称"
					});
					return;
				} else if (!this.storeInfo.merchantPerson) {
					uni.showToast({
						icon: "none",
						title: "请输入联系人姓名"
					});
					return;
				} else if (!this.storeInfo.merchantPhone) {
					uni.showToast({
						icon: "none",
						title: "请输入联系人电话"
					});
					return;
				} else if (!this.storeInfo.sellerClassId) {
					uni.showToast({
						icon: "none",
						title: "请选择主营类目"
					});
					return;
				} else if (!this.storeInfo.businessCode) {
					uni.showToast({
						icon: "none",
						title: "请选择微信类目"
					});
					return;
				} else if (!this.storeInfo.imgLogo) {
					uni.showToast({
						icon: "none",
						title: "请上传商户门头照片"
					});
					return;
				}else if (this.storeInfo.entType==2||this.storeInfo.entType==3||this.storeInfo.entType==4) {
					if(!this.storeInfo.imgCashierDesk){
						uni.showToast({
							icon: "none",
							title: "请上传店铺内景照"
						});
						return;
					}
					
				} else if (!this.storeInfo.licenseNo && this.storeInfo.merchantBusinessType != 3) {
					uni.showToast({
						icon: "none",
						title: "请输入营业执照号"
					});
					return;
				} else if (!this.storeInfo.licenseAddress && this.storeInfo.merchantBusinessType != 3) {
					uni.showToast({
						icon: "none",
						title: "请输入营业执照地址"
					});
					return;
				} else if ((!this.storeInfo.licenseStart || this.storeInfo.licenseStart == 0) && this.storeInfo
					.merchantBusinessType != 3) {
					uni.showToast({
						icon: "none",
						title: "请选择营业执照开始时间"
					});
					return;
				} else if ((!this.storeInfo.licenseEnd || this.storeInfo.licenseEnd == 0) && this.storeInfo
					.merchantBusinessType != 3) {
					uni.showToast({
						icon: "none",
						title: "请选择营业执照结束时间"
					});
					return;
				} else if (!this.storeInfo.imgLicense && this.storeInfo.merchantBusinessType != 3) {
					uni.showToast({
						icon: "none",
						title: "请上传营业执照"
					});
					return;
				}

				uni.navigateTo({
					url: "/pages/storeManage/edit-store-address?parameter=" + JSON.stringify(this.storeInfo)
				});
			},
			bindDateChangeStart(e) {
				this.storeInfo.licenseStart = e.detail.value;
			},
			bindDateChangeEnd(e) {
				this.storeInfo.licenseEnd = e.detail.value;
			},
			getDate(type) {
				const date = new Date();
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();

				if (type === 'start') {
					year = year - 60;
				} else if (type === 'end') {
					year = year + 80;
				}
				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				return `${year}-${month}-${day}`;
			},
			openEntType() {
				this.showEntType = true;
			},
			selectEntType(data) {
				this.storeInfo.entType = data.id;
				this.EnttypeText = data.label;
				this.showEntType = false;
			},
			openFound() {
				this.showFoundDate = true;
			},
			closeFoundDate() {
				this.showFoundDate = false;
			},
			sureDoundDate(e) {
				console.log(e)
				const date = new Date(e.value);
				let year = date.getFullYear();
				let month = date.getMonth() + 1;
				let day = date.getDate();


				month = month > 9 ? month : '0' + month;
				day = day > 9 ? day : '0' + day;
				this.storeInfo.foundDate = `${year}-${month}-${day}`;
				console.log(this.storeInfo.foundDate)
				this.showFoundDate = false;
			},
			formatterDate(type, value) {
				console.log(type, value)
				if (type === 'year') {
					return `${value}年`
				}
				if (type === 'month') {
					return `${value}月`
				}
				if (type === 'day') {
					return `${value}日`
				}
				return value
			},
			async afterReadCashier(event) {
				console.log(event)
				// 当设置 multiple 为 true 时, file 为数组格式，否则为对象格式
				let lists = [];
				lists[0] = event.file;

				let fileListLen = this.CashierList.length
				lists.map((item) => {
					this.CashierList.push({
						...item,
						status: 'uploading',
						message: '上传中'
					})
				})
				for (let i = 0; i < lists.length; i++) {
					const result = await this.uploadFilePromise(lists[i].url)
					let item = this.CashierList[fileListLen]
					this.CashierList.splice(fileListLen, 1, Object.assign(item, {
						status: 'success',
						message: '',
						url: result
					}))
					fileListLen++
				}
				this.getCashierDeskImgList(this.CashierList);
			},
			getCashierDeskImgList(list) {
				console.log(list)
				if (list.length == 0) {
					this.CashierImg = [];
				} else {
					this.CashierImg = list.map((item) => {
						let imgUrl = item.url[0].path + '/' + item.url[0].name;
						return imgUrl
					})
				}
				this.storeInfo.imgCashierDesk = this.CashierImg.join(",");
			},
			deletePicCashier(event){
				this.CashierList.splice(event.index, 1)
				this.getCashierDeskImgList(this.CashierList);
			},
			closeEntType(){
				this.showEntType=false;
			}

		},
	};
</script>

<style lang="scss">
	.my-store-info {
		background-color: #f4f5f7;
		padding-top: 20rpx;
	}

	.store-box {
		width: 650rpx;
		margin-left: 30rpx;
		background-color: #fff;
		border-radius: 20rpx;
		margin-bottom: 20rpx;
		padding: 20rpx;

		.title {
			font-size: 28rpx;
			font-weight: bold;
			margin-bottom: 20rpx;
		}
	}

	/deep/ .u-cell__title-text {
		font-size: 28rpx;
	}

	/deep/ .u-input {
		flex: 2
	}

	.scroll-Y {
		max-height: 90vh;
	}

	.tylist {
		padding: 30rpx;


		.li {
			padding-top: 20rpx;
			padding-bottom: 20rpx;
			font-size: 28rpx;
			border-bottom: 2rpx solid #f4f5f7;
		}

		.li-one-box {

			.li-one-title {
				padding-top: 20rpx;
				padding-bottom: 20rpx;
				font-size: 28rpx;
				border-bottom: 2rpx solid #f4f5f7;
			}

			.li-two-box {
				margin-left: 20rpx;

				.li-two-title {
					padding-top: 20rpx;
					padding-bottom: 20rpx;
					font-size: 28rpx;
					border-bottom: 2rpx solid #f4f5f7;
				}

				.li-three-box {
					margin-left: 30rpx;

					.li-three-title {
						padding-top: 20rpx;
						padding-bottom: 20rpx;
						font-size: 28rpx;
						border-bottom: 2rpx solid #f4f5f7;
					}
				}
			}
		}
	}

	.btn {
		width: 690rpx;
		height: 100rpx;
		line-height: 100rpx;
		font-weight: bold;
		color: #fff;
		text-align: center;
		background: linear-gradient(to right, #3CBAF6, #56D1FC);
		margin-left: 30rpx;
	}
</style>